<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5-5 随机生成指定长度的字符串</title>
</head>
<body>
<script>
 function randomString0(n) {
            var result = '';
            for (var i = 0; i < n; i++) {
                
                var unicodeValue = Math.floor(Math.random() * (90 - 65 + 1)) + 65;
                
                result += getLetters0(unicodeValue);
            }
            return result;
        }

        function getLetters0(unicodeValue) {
            return String.fromCharCode(unicodeValue);
        }
        
        console.log(randomString0(3));
</script>
</body>
</html>